package com.googlecode.linkmein.domain;

import com.googlecode.linkmein.utils.Util;

public class Project {
    private String name;
    private Employees members = new Employees();

    public Project(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return getName();
    }

    static public Project NULL = new NullProject();

    public String getName() {
        if (Util.isEmpty(name)) {
            return "Overhead";
        } else if (name.equalsIgnoreCase("1")) {
            return "Beach balls";
        } else if (name.equalsIgnoreCase("0.5")) {
            return "Part time";
        } else {
            return name;
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Project project = (Project) o;

        if (getName() != null ? !getName().equals(project.getName()) : project.getName() != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return getName() != null ? getName().hashCode() : 0;
    }

    public void addMember(Employee employee) {
        if (!members.contains(employee)) {
            members.add(employee);
        }
    }

    public Employees getMembers() {
        return members;
    }

}